package com.zxy.ziems.server.alarm.enums;

/**
 * @Author: 10546533
 * @Description: 可燃气体告警类型枚举类
 * @Date: 2024/5/10 16:24
 */
public enum GasAlarmStatusEnum {
    COMMUCFAULT(1, "通讯故障"),
    SENSORFAULT(2, "传感器故障"),
    NODEVICE(7, "此地址无对应探测器"),
    LOWALARM(14, "底限报警"),
    HIGHALARM(15, "高限报警"),
    NORAMAL(10, "正常");

    private final Integer code;
    private final String info;

    GasAlarmStatusEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static String getByCode(String code) {
        for (GasAlarmStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getInfo();
            }
        }
        return null;
    }

    public static Boolean hasGasAlarm(String code) {
        return !(code.equals(NORAMAL.code));
    }
}
